#ifndef ENTER_H
#define ENTER_H
#include <QDialog>
#include<QAbstractButton>
#include <QPushButton>
#include <QWidget>
#include <QPoint>
#include <QLabel>
#include <QVBoxLayout>
#include "Network.h"
#include "XRound_border.h"
#include "XMainWindow.h"
//登录界面一切开始
namespace Ui {
class enter;
}

//鼠标事件类
class Mouset : public QPushButton{
   Q_OBJECT
public:
    explicit Mouset(QWidget *parent = nullptr);
    ~Mouset()override;

signals:
    void entered();
    void leaved();
 protected:
    void enterEvent(QEvent *event)override;
    void leaveEvent(QEvent *event)override;
};

//登录窗口类
class enter : public QDialog
{
    Q_OBJECT

public:
    explicit enter(QWidget *parent = nullptr);
    ~enter();

protected:
    //注册账号检测
    void RegisterAccount();
     //密码检测
    void RegisterPasswd();
private slots:
    //手机号登录页面
    void on_phoebtn_clicked();
    //账号登录页面
    void on_accountbtn_clicked();
   // void on_phoebtn_toggled(bool checked);
   //显示密码按钮
    void on_pushButton_toggled(bool checked);
    //手机验证码
    void on_pushButton_2_clicked();
    //登录按钮
    void enterbtn_clicked();
    //切换到注册页面
    void on_registe_btn_clicked();
    //注册按钮
    void certain_clicked();
    //切换到登录页面
    void on_pushButton_3_clicked();
    //注册账号框
    void on_account_Edit_editingFinished();
    //注册密码框
    void on_passwd_Edit_editingFinished();



signals:
    //确认登录
    void isOk();
private:
    NetData *net;
    std::shared_ptr<MainWindow> mainwin;
    std::shared_ptr<Round_Button> gbnt;//注册按钮
    std::shared_ptr<Round_Button> bnt;//登录按钮
    std::shared_ptr<QVBoxLayout> m_vbox;

    //验证码
    std::shared_ptr<QTimer> CodeCount;
    int codes=60;

    //登录账号/手机号 INFO
    QString account;
    QString password;
    QString phonNuber;
    QString chiekCode;

    //注册账号
    QLabel *reg_acount_label;
    QLabel *reg_passwd_label;
    bool isReady=false;
    QString reg_account;
    QString reg_passwd;
    QString reg_repasswd;

    Ui::enter *ui;
};
#endif // ENTER_H
